﻿<!doctype html>
<html>
	<head>
		<title>羽乐汇</title>
		<meta name="keywords" content="羽毛球，球会，球场，教练">
		<meta name="charset" content="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/bootstrap.min.css">
		<!-- <link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/wap_index.css"> -->
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/CSS/HomePage/index.css">
		
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/jquery.min.js"></script>
		
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/bootstrap.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/JS/HomePage/md5.js"></script>
		<!--<script type="text/javascript" src="__PUBLIC__/JS/HomePage/index.js"></script>-->
    </head>
	<body>
	<!-- ---------------------------------------------------------------pc_index--------------------------------------------------------- -->
		<div class="pc_coach container-fluid">
			<!-- <div class="top visible-lg visible-md"> -->
		<div class="top visible-lg visible-md">
			<div class="ttop">
				<span>欢迎来到羽乐汇</span>
				<div>
					<span class="wellcome"></span>
					<span class="login">
						<button class="login_btn">登陆</button>
						<!-- <button class="notlogin_btn">注销</button> -->
						<a href="<{:U('Index/registration')}>">注册</a>
						
					</span>
					<!-- <button class="sign_btn">注册</button> -->
					<a class="login_after" href="<{:U('User/index')}>">个人主页</a>
					<a href="__PUBLIC__/HTML/vip_center.html">vip中心</a>
				</div>
			</div>
			<div>
				<img src="__PUBLIC__/PICTURE/HomePage/logo.jpg">
			</div>
			<div class="main_nav">
				<ul>
					<li><a href="<{:U('Index/index')}>">首页</a></li>
					<li><a href="<{:U('Gymnasium/index')}>">球场</a></li>
					<li><a href="<{:U('Club/index')}>">球会</a></li>
					<li>培训</li>
					<li><a href="<{:U('Activity/activity')}>">活动</a></li>
					<li><a href="<{:U('Coach/index')}>">教练</a></li>
					<li>竞赛</li>
					<li><a href="<{:U('Announce/index')}>">公告</a></li>
				</ul>
			</div>
		</div>
			<header class="row visible-xs visible-sm header_nav">
				<a href="<{:U('Index/index')}>"><img src="__PUBLIC__/PICTURE/HomePage/pre.png"/></a>
				<span>球馆页面</span>
			</header>
			<div class="search_content">
				<div class="top_search">
					<form action="" name="search_form" method="post" >
						<input type="text" name="search_keyword" class="" id="searchword" holder="请输入您要搜索的关键词" value="" />
						<button class="" rel="search_btn" id="searchbutton" type="button">搜索</button>
					</form>
				</div>
			</div>
			<div class="coach_content">
					<div class="introduce_court">
					<div class="head"><span>返回上一页</span></div>
					<div class="court_about">
						<div class="img_div"><img src="" alt="头像"></div>
						<div class="content">
							<ul>
								<li><span>馆长：</span>某某某</li>
								<li>地址：<span>某某某某某某</span></li>
								<li>
									<div class="my_con visible-lg visible-md">
										<span>球馆介绍：</span><br/>
										<div>羽乐是一款便于羽毛球兴趣协会（球会）组织工作的工具软件为切入，聚合球会会员社交，球场O2O等多项功能的app软件。提供会员创建球会，组织活动，活动报名，活动积分，资料共享，会员聊天，球场订场，教练培训等多项功能，是羽毛球爱好者、球场经营者，羽球教练深度使用的应用软件</div>
									</div>
								</li>
							</ul>
						</div>
						<div class="visible-sm visible-xs my_con_wap">
							<span>球馆介绍：</span><br/>
							<div>羽乐是一款便于羽毛球兴趣协会（球会）组织工作的工具软件为切入，聚合球会会员社交，球场O2O等多项功能的app软件。提供会员创建球会，组织活动，活动报名，活动积分，资料共享，会员聊天，球场订场，教练培训等多项功能，是羽毛球爱好者、球场经营者，羽球教练深度使用的应用软件</div>
						</div>
					</div>
				</div>
				<{:W('Gymnasium/Gymnasium_list')}>
				<div class="content_foot">
					<ul>
						<li><button class="pageup" type="button" disabled="disabled">上一页</button></li>
						<li><button class="pagedown" type="button" disabled="disabled">下一页</button></li>
					</ul>
				</div>
			</div>
		</div>
		<div class="foot row">
			<div>
				<p>联系我们</p>
				<p>关于我们</p>
				<p>加入我们</p>
			</div>
			<div>
				<p>电话：400-800-8888 周一至周六9：00-18：00</p>
				<p>[羽乐汇]<a href="http://oto.my3w.com">http://oto.my3w.com</a></p>
			</div>
		</div>
		<script type="text/javascript">
		var province; //省名
		var city ;  //城市名
		var district;   //区县名
		var page_num=1; //当前页数
		var pagetype=0;
		var totalPage;
		var gymnasium_count;  //后台返回球场条数
		var gymnasiumJson;  //公告内容Json数组

		<!------------------打开页面异步加载球场------------------>

		$(function(){
			// getLocation();
			$.post('__URL__/listAllGymnasium',{'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				gymnasium_count=resultList.gymnasium_count;
				gymnasiumJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
		});
		function setpage(){
			totalPage=Math.ceil(gymnasium_count/5);
			if(page_num>1){
				$(".pageup").attr('disabled',false);
			}
			else{
				$(".pageup").attr('disabled',true);
			}
			if(totalPage>page_num){
				$(".pagedown").attr('disabled',false);
			}
			else{
				$(".pagedown").attr('disabled',true);
			}
			if(page_num<totalPage){
				for (var i = 0; i <= 4; i++) {
					var img=".img"+i;
					var gymnasium_name="#gymnasium_name"+i;
					var gymnasium_location_bref="#gymnasium_location_bref"+i;
					var gymnasium_phone_number="#gymnasium_phone_number"+i;
					var detail="#detail"+i;
					var total="#total"+i;
					var id=gymnasiumJson[i].gymnasium_id;
					$(total).css('display','block');
					var detailurl="<{:U('Gymnasium/courtPage')}>"+"&gymnasium_id="+id;
					$(img).html('<img src="'+gymnasiumJson[i].gymnasium_picture+'">');
					$(gymnasium_name).html('<span>球馆名:'+gymnasiumJson[i].gymnasium_name+'<spam>');
					$(gymnasium_location_bref).html('<span>球馆位置:'+gymnasiumJson[i].gymnasium_location_bref+'<spam>');
					$(gymnasium_phone_number).html('<span>球馆电话:'+gymnasiumJson[i].gymnasium_phone_number+'<spam>');
					$(detail).html('<a href='+detailurl+'>详情</a>');
				}
			}
			else{
				for (var i = 0; i <= gymnasium_count-(page_num-1)*5-1; i++) {
					var img=".img"+i;
					var gymnasium_id="#gymnasium_id"+i;
					var gymnasium_name="#gymnasium_name"+i;
					var gymnasium_location_bref="#gymnasium_location_bref"+i;
					var gymnasium_phone_number="#gymnasium_phone_number"+i;
					var detail="#detail"+i;
					var id=gymnasiumJson[i].gymnasium_id;
					var total="#total"+i;
					$(total).css('display','block');
					var detailurl="<{:U('Gymnasium/courtPage')}>"+"&gymnasium_id="+id;
					$(img).html('<img src="'+gymnasiumJson[i].gymnasium_picture+'">');
					$(gymnasium_name).html('<span>球馆名:'+gymnasiumJson[i].gymnasium_name+'<spam>');
					$(gymnasium_location_bref).html('<span>球馆位置:'+gymnasiumJson[i].gymnasium_location_bref+'<spam>');
					$(gymnasium_phone_number).html('<span>球馆电话:'+gymnasiumJson[i].gymnasium_phone_number+'<spam>');
					$(detail).html('<a href='+detailurl+'>详情</a>');
				}
				for(var i = gymnasium_count-(page_num-1)*5; i <= 4; i++){
					var img=".img"+i;
					var gymnasium_id="#gymnasium_id"+i;
					var gymnasium_name="#gymnasium_name"+i;
					var gymnasium_location_bref="#gymnasium_location_bref"+i;
					var gymnasium_phone_number="#gymnasium_phone_number"+i;
					var detail="#detail"+i;
					var total="#total"+i;
					$(total).css('display','none');
					$(img).html("");
					$(gymnasium_name).html("");
					$(gymnasium_location_bref).html("");
					$(gymnasium_phone_number).html("");
					$(detail).html("");
				}
			}
		}
		//上一页
		$('.pageup').bind('click',function(){
			if(pagetype==0){
			page_num--;
			$.post('__URL__/listAllGymnasium',{'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				gymnasium_count=resultList.gymnasium_count;
				gymnasiumJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
		}
			else if(pagetype==1){
				page_num--;
				$.post('__URL__/listDistrictGymnasium',{'gymnasium_province':province, 'gymnasium_city':city, 'gymnasium_district':district, 'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				gymnasium_count=resultList.gymnasium_count;
				gymnasiumJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
			}
			else{
				page_num--;
				var gymnasium_name=$("#searchword").val();
				$.post('__URL__/announceSearch',{'gymnasium_name':gymnasium_name,'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				gymnasium_count=resultList.gymnasium_count;
				gymnasiumJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
			}
		});
		//下一页
		$('.pagedown').bind('click',function(){
			if(pagetype==0){
				page_num++;
			$.post('__URL__/listAllGymnasium',{'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				gymnasium_count=resultList.gymnasium_count;
				gymnasiumJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
		}
			else if(pagetype==1){
				page_num++;
				$.post('__URL__/listDistrictGymnasium',{'gymnasium_province':province, 'gymnasium_city':city, 'gymnasium_district':district, 'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				gymnasium_count=resultList.gymnasium_count;
				gymnasiumJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
			}
			else{
				page_num++;
				var gymnasium_name=$("#searchword").val();
				$.post('__URL__/announceSearch',{'gymnasium_name':gymnasium_name,'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				gymnasium_count=resultList.gymnasium_count;
				gymnasiumJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
			}
		});

<!----------调用百度API返回位置信息------------>
		function getLocation(){
			if (navigator.geolocation){
				navigator.geolocation.getCurrentPosition(showPosition,showError);
			}else{
		alert("浏览器不支持地理定位。");
			}
		}
		function showPosition(position){ 
    	var latlon = position.coords.latitude+','+position.coords.longitude; 
     
    	//baidu 
    		var url = "http://api.map.baidu.com/geocoder/v2/?ak=C93b5178d7a8ebdb830b9b557abce78b&callback=renderReverse&location="+latlon+"&output=json&pois=0"; 
   		 $.ajax({  
       		 type: "GET",  
       		 dataType: "jsonp",  
       		 url: url, 
      		  beforeSend: function(){ 
         		   $("#baidu_geo").html('正在定位...'); 
       		 }, 
        		success: function (json) {  
          		  if(json.status==0){ 
          		      $("#baidu_geo").html(json.result.addressComponent.city); 
          		      province=json.result.addressComponent.province;
          		      city=json.result.addressComponent.city;
          		      district=json.result.addressComponent.district;
          		  } 
      		  }, 
       		 error: function (XMLHttpRequest, textStatus, errorThrown) {  
       		     $("#baidu_geo").html(latlon+"地址位置获取失败");  
       		 } 
   		 }); 
		} 
		function showError(error){
			switch(error.code) {
				case error.PERMISSION_DENIED:
					alert("定位失败,用户拒绝请求地理定位");
					break;
				case error.POSITION_UNAVAILABLE:
					alert("定位失败,位置信息是不可用");
					break;
				case error.TIMEOUT:
					alert("定位失败,请求获取用户位置超时");
					break;
				case error.UNKNOWN_ERROR:
					alert("定位失败,定位系统失效");
					break;
 		   }
		}

		getLocation();
		$('#local').click(function () { 
			alert(province);
			page_num=1;
			pagetype=1;
			$.post('__URL__/listDistrictGymnasium',{'gymnasium_province':province, 'gymnasium_city':city, 'gymnasium_district':district, 'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				gymnasium_count=resultList.gymnasium_count;
				gymnasiumJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 

		}); 
		<!------------------搜索------------------>
		$("#searchbutton").bind("click",function(){
  			var gymnasium_name=$("#searchword").val();
  			page_num=1;
  			pagetype=2;
  			$.post('__URL__/searchAllGymnasium',{'gymnasium_name':gymnasium_name,'page_num':page_num},function(resultList){
				page_num=resultList.page_num;
				gymnasium_count=resultList.gymnasium_count;
				gymnasiumJson=resultList.result;
    	},'json');
			setTimeout("setpage()",100); 
		});


		</script>
	</body>
</html>